#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>


int main()
{
    pid_t id=fork();

    if(id==0)
    {
        int cnt=500;
        //子进程
        while(cnt)
        {
            printf("this is child: pid:%d ppid:%d cnt:%d\n",getpid(),getppid(),cnt);
            cnt--;
            sleep(1);
        }
    }
    else
    {
        int cnt=5;
        //父进程
        while(cnt)
        {
           printf("this is parent: pid:%d ppid:%d cnt:%d\n",getpid(),getppid(),cnt);
           sleep(1);
           cnt--;
        }
    }

    return 0;
}
